package com.zhuoli.zblog.repository.service.impl;

import com.zhuoli.zblog.repository.dao.UserRoleMapper;
import com.zhuoli.zblog.repository.model.UserRole;
import com.zhuoli.zblog.repository.model.UserRoleExample;
import com.zhuoli.zblog.repository.service.UserRoleDaoRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Author: zhuoli
 * Description:
 * Date: 上午11:02 2018/4/22
 */
@Repository
public class UserRoleDaoRepositoryImpl implements UserRoleDaoRepository {

    @Autowired
    UserRoleMapper userRoleMapper;

    @Override
    public List<UserRole> queryUserRoleByUserId(Integer userId) {
        UserRoleExample userRoleExample = new UserRoleExample();
        userRoleExample.createCriteria()
                .andUserIdEqualTo(userId);
        return userRoleMapper.selectByExample(userRoleExample);
    }
}
